package com.wgl.order.api;

import com.wgl.order.service.ZfbService;
import com.wgl.yygh.result.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author wgl
 * @version 1.0.0
 * @ClassName ZfbController.java
 * @Description TODO
 * @createTime 2022年02月14日 22:28:00
 */
@RestController
@RequestMapping("/api/order/zfb")
public class ZfbController {
    @Resource
    private ZfbService zfbService;
    // http://localhost:8206/api/order/zfb/createNative/{orderId}
    /**
    * @Author: Wgl
    * @Description: 生成支付二维码 支付宝沙箱
    * @Date: 2022/2/15 20:20;
    * @param orderId: ;
    * @return: com.wgl.yygh.result.Result;
    */
    @GetMapping("/createNative/{orderId}")
    public Result createNative(@PathVariable Long orderId){
        Map map = zfbService.createNative(orderId);
        return Result.ok(map);
    }
    @GetMapping("/queryPayStatus/{orderId}")
    public Result queryPayStatus(@PathVariable Long orderId){
        String staus = zfbService.queryPayStatus(orderId);
        Result<Object> ok = Result.ok(null);
        ok.setMessage(staus);
        return ok;
    }
    @GetMapping("/dl")
    public Result dl(){
//        String staus = ;
//        Result<Object> ok = Result.ok(null);
//        ok.setMessage(staus);
        return Result.ok(zfbService.dl());
    }


}
